package com.ems.service.impl.supers.action;


import com.ems.dao.supers.action.UserGroupDao;
import com.ems.pojo.permission.UserGroup;
import com.ems.service.supers.action.UserGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: 伟伟
 * @Date: 2019/10/5
 * @Description: 描述
 * @Version: 1.0
 */
@Service("UserGroupService")
public class UserGroupServiceImpl implements UserGroupService {

    @Autowired
    private UserGroupDao userGroupDao;

    /**
     * 为指定的用户添加角色
     * @param userGroup
     * @return
     */
    @Override
    public int addUserGroup(UserGroup userGroup) {
        return userGroupDao.addUserGroup(userGroup);
    }

    /**
     * 删除指定用户的角色
     * @param userGroup
     * @return
     */
    @Override
    public int deleteUserGroup(UserGroup userGroup) {
        return userGroupDao.deleteUserGroup(userGroup);
    }

    //查询该角色下面的角色数
    @Override
    public int getCountByGrId(int gr_id) {
        return userGroupDao.getCountByGrId(gr_id);
    }

    @Override
    public void deleteUserGroupById(int id) {
        userGroupDao.deleteUserGroupById(id);
    }
}
